package com.org.gundutubruk;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

public class WInnerActivity extends Activity{
	TextView nama;
	public ImageView avatar;
	public TextView gundu;
	Button next;
	public String namamenang;
	public int gundumenang;
	public int avatarid;
	boolean isMultiplayer;
	
	int apatarawal=R.drawable.apatar0;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {			
		super.onCreate(savedInstanceState);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
		setContentView(R.layout.winner_layout);
		Bundle b = getIntent().getExtras();
		String namamenang = b.getString("namamenang");
		int gundumenang = b.getInt("gundumenang");
		int avatarid = b.getInt("avatarid");
		isMultiplayer = b.getBoolean("isMultiplayer", false);
		avatar=(ImageView)findViewById(R.id.avatarmenang);
		avatar.setImageResource(apatarawal+avatarid);
		nama=(TextView)findViewById(R.id.namamenang);
		nama.setText(namamenang);
		gundu=(TextView)findViewById(R.id.gundumenang);
		gundu.setText(""+gundumenang);		
		next=(Button)findViewById(R.id.ok);
		next.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View arg0){ 
				okPressed();
			}
		});
		Log.d("ss", "Jumlah player : "+Utility.playerHolder.size());
	}
	
	@Override
	public void onBackPressed() {
		okPressed();
	}

	private void okPressed() {
		Intent listRekap = new Intent(this,ListRekap.class);
		if(isMultiplayer) {					
			Bundle b = new Bundle();
			b.putBoolean("isMultiplayer",true);
			listRekap.putExtras(b);						
		}
		startActivity(listRekap);
		overridePendingTransition(R.anim.fade, R.anim.hold);
		finish();		
	}
	
}
